package com.coolbi.onsupai.core.biz.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.coolbi.onsupai.core.biz.RefundGoodsBiz;
import com.coolbi.onsupai.core.dao.RefundGoodsDao;
import com.coolbi.onsupai.core.entity.RefundGoods;
import com.coolbi.onsupai.core.exception.ServiceException;

public class RefundGoodsBizImpl implements RefundGoodsBiz {

	@Autowired
	private RefundGoodsDao refundGoodsDao;
	public void setRefundGoodsDao(RefundGoodsDao refundGoodsDao) {
		this.refundGoodsDao = refundGoodsDao;
	}
	
	@Override
	public RefundGoods save(RefundGoods obj) {
		try {
			refundGoodsDao.save(obj);
		} catch (Exception e) {
			throw new ServiceException("添加退换货单发生错误！", e);
		}
		return obj;
	}

	@Override
	public void delete(long id) {
		try {
			refundGoodsDao.delete(id);
		} catch (Exception e) {
			throw new ServiceException("删除退换货单发生错误！", e);
		}
	}

	@Override
	public void update(RefundGoods obj) {
		try {
			refundGoodsDao.update(obj);
		} catch (Exception e) {
			throw new ServiceException("修改退换货单发生错误！", e);
		}
	}

	@Override
	public RefundGoods get(long id) {
		return refundGoodsDao.get(id);
	}

	@Override
	public List<RefundGoods> list() {
		return refundGoodsDao.list();
	}

	@Override
	public List<RefundGoods> listByPage(int offset, int limit) {
		return refundGoodsDao.listByPage(offset, limit);
	}

	@Override
	public List<RefundGoods> find(Map<String, Object> parameter) {
		return refundGoodsDao.find(parameter);
	}

	@Override
	public List<RefundGoods> findByPage(Map<String, Object> parameter,
			int offset, int limit) {
		return refundGoodsDao.findByPage(parameter, offset, limit);
	}

	@Override
	public List<RefundGoods> search(Map<String, Object> parameter, int offset,
			int limit) {
		return refundGoodsDao.search(parameter, offset, limit);
	}

	@Override
	public int count() {
		return refundGoodsDao.count();
	}

	@Override
	public int countByKeyWord(Map<String, Object> parameter) {
		return refundGoodsDao.countByKeyWord(parameter);
	}

	@Override
	public int count(Map<String, Object> parameter) {
		return refundGoodsDao.count(parameter);
	}

}
